package controller;

import com.pojo.User;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    @RequestMapping("/getUserId")
    public void getUserId(HttpServletRequest request){
        String userId = request.getParameter("userId");
        System.out.println("userId = " + userId);
    }
    @RequestMapping("/getUserName")
    public void getUserName(
            @RequestParam(value = "name", required = false,defaultValue = "itheima") String username
    ){
        System.out.println("username = " + username);
    }
    @RequestMapping("/registerUser")
    public void registerUser(User user) {
        String name = user.getName();
    }
        @RequestMapping("/registerUser")
        public void registerUser(User user){
            String name = user.getName();
            String password = user.getPassword();
            System.out.println("name = " + name);
            System.out.println("password = " + password);
        }
    }